<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>${teacher.name} - 老师详情</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f7fa;
            color: #333;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        .teacher-header {
            display: flex;
            align-items: center;
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-bottom: 30px;
        }
        .teacher-avatar {
            width: 150px;
            height: 150px;
            border-radius: 50%;
            object-fit: cover;
            border: 5px solid #f0f0f0;
            margin-right: 40px;
        }
        .teacher-info {
            flex: 1;
        }
        .teacher-name {
            font-size: 28px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #2c3e50;
        }
        .teacher-title {
            font-size: 18px;
            color: #7f8c8d;
            margin-bottom: 15px;
        }
        .teacher-bio {
            line-height: 1.6;
            color: #555;
        }
        .courses-section {
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .section-title {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 20px;
            color: #2c3e50;
            padding-bottom: 10px;
            border-bottom: 2px solid #f0f0f0;
        }
        .courses-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
        }
        .course-card {
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 3px 10px rgba(0,0,0,0.1);
            transition: transform 0.3s;
        }
        .course-card:hover {
            transform: translateY(-5px);
        }
        .course-cover {
            width: 100%;
            height: 150px;
            object-fit: cover;
        }
        .course-info {
            padding: 15px;
        }
        .course-title {
            font-weight: bold;
            margin-bottom: 5px;
            font-size: 16px;
        }
        .course-meta {
            font-size: 14px;
            color: #7f8c8d;
        }
        .btn-back {
            display: inline-block;
            padding: 10px 20px;
            background: #3498db;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            margin-bottom: 20px;
            transition: background 0.3s;
        }
        .btn-back:hover {
            background: #2980b9;
        }
    </style>
</head>
<body>
<div class="container">
    <a href="javascript:history.back()" class="btn-back">返回</a>

    <!-- 老师基本信息 -->
    <div class="teacher-header">
        <img src="${teacher.icon}" class="teacher-avatar" alt="${teacher.name}的头像">
        <div class="teacher-info">
            <h1 class="teacher-name">${teacher.name}</h1>
            <div class="teacher-bio">${teacher.introductory}</div>
        </div>
    </div>

    <!-- 老师教授的课程 -->
    <div class="courses-section">
        <h2 class="section-title">${teacher.name}的课程</h2>
        <div class="courses-grid">
            <c:forEach items="${goods}" var="goods">
                <div class="book-card" onclick="window.location.href='${pageContext.request.contextPath}/student/detail?gid=${goods.gid}'">
                <div class="course-card">
                    <img src="${goods.img}" class="course-cover" alt="${goods.gname}封面">
                    <div class="course-info">
                        <div class="course-title">${goods.gname}</div>
                        <div class="course-meta">
                            <span>课程类型：${goods.type}</span>
                            <span>|</span>
                            <span>${goods.duration}课时</span>
                        </div>
                        </div>
                    </div>
                </div>
            </c:forEach>
        </div>
    </div>
</div>

<!-- 使用Font Awesome图标 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</body>
</html>